# coding: utf-8
# Set up the path to the .NET Framework.
import sys

# Make clr accessible.
import clr

# Add any required references.
clr.AddReference('System.Windows.Forms.DLL')
clr.AddReference('System.Drawing.DLL')
clr.AddReference('System.Data.DLL')



# Import the .NET assemblies.
import System
import System.Windows.Forms
import System.Drawing.Point
import System.Data

class form(System.Windows.Forms.Form):

    # This function performs all of the required initialization.
    def InitializeComponent(self):
        
        self.tabcontrol=System.Windows.Forms.TabControl()
        self.tabcontrol.Size =System.Drawing.Size(1350, 800)
        
        
        self.tabpage1=System.Windows.Forms.TabPage()
        self.tabpage1.Text="主页面"
        self.tabpage1.Name="tab_1"
        self.tabpage1.Size =System.Drawing.Size(1000, 200)
        
        self.tabpage2=System.Windows.Forms.TabPage()
        self.tabpage2.Text="SOME/IP"
        self.tabpage2.Name="tab_2"
        self.tabpage2.Size =System.Drawing.Size(1000, 200)
        
        
        
# --------tab1-----------tab1-----------tab1 ----------tab1---------tab1----------      
        # Configure btnConnect
        self.btnConnect = System.Windows.Forms.Button()
        self.btnConnect.Text = " Receive"
        self.btnConnect.Location = System.Drawing.Point(20, 20)
        
        # Configure btnClear
        self.btnClear = System.Windows.Forms.Button()
        self.btnClear.Text = "&Clear"
        self.btnClear.Location = System.Drawing.Point(120, 20)
        
        # Configure btnSave
        self.btnSave = System.Windows.Forms.Button()
        self.btnSave.Text = "&Save"
        self.btnSave.Location = System.Drawing.Point(220, 20)       
       
        # Configure btnSend
        self.btnSend = System.Windows.Forms.Button()
        self.btnSend.Text = "&Send"
        self.btnSend.Location = System.Drawing.Point(320, 20)  
       
      
        self.textBox1 = System.Windows.Forms.TextBox()
        self.textBox1.Text="" 
        self.textBox1.Location = System.Drawing.Point(20, 60)
        self.textBox1.Size = System.Drawing.Size(700, 60)
        self.textBox1.Name = "textBox1"
        #self.SuspendLayout();
 
        #self.textBox1.AcceptsReturn = True;
        #self.textBox1.AcceptsTab = True;
        #self.textBox1.Dock = System.Windows.Forms.DockStyle.Fill;
        #self.textBox1.Multiline = None;
        #self.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
        #self.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.None;
        
        self.DataArea = System.Windows.Forms.DataGridView()
        
        self.DataArea.Name = "DataArea"
        self.DataArea.Location = System.Drawing.Point(20, 100)
        self.DataArea.Size = System.Drawing.Size(700, 200)
        #self.DataArea.Dock = System.Windows.Forms.DockStyle.Fill
        # 滚动条
        self.DataArea.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        #self.DataArea.ScrollBars = System.Windows.Forms.ScrollBars.None;

        self.DataArea.Name = "textBox1"
   
        self.DataArea.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.DeepSkyBlue   #DeepSkyBlue
        self.DataArea.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Red
        #Self.DataArea.ColumnHeadersDefaultCellStyle.Font = System.Drawing.Font(DataArea.Font, FontStyle.Bold)

        self.DataArea.AutoSizeRowsMode =System.Windows.Forms.DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
        
        self.DataArea.ColumnHeadersBorderStyle =System.Windows.Forms.DataGridViewHeaderBorderStyle.Single
        self.DataArea.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Single
        self.DataArea.GridColor = System.Drawing.Color.Black
        # 行标题可见
        self.DataArea.RowHeadersVisible = False
        
        self.DataArea.ColumnCount = 7

        self.DataArea.Columns[0].Name = "No."
        self.DataArea.Columns[1].Name = "Time"
        self.DataArea.Columns[2].Name = "Source"
        self.DataArea.Columns[3].Name = "Destination"
        self.DataArea.Columns[4].Name = "Protocol"
        self.DataArea.Columns[5].Name = "Length"
        self.DataArea.Columns[6].Name = "Info"

        
        # 深的天蓝色
        self.DataArea.RowHeadersDefaultCellStyle.BackColor = System.Drawing.Color.DeepSkyBlue
        self.DataArea.GridColor = System.Drawing.Color.Black
        self.DataArea.SelectionMode =System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
        self.DataArea.RowHeadersWidth=180
        
       
        
        
        
        # inputArea
        self.inputArea = System.Windows.Forms.DataGridView()
        
        self.inputArea.Name = "inputArea"
        self.inputArea.Location = System.Drawing.Point(750, 10)
        self.inputArea.Size = System.Drawing.Size(580, 205)
        #self.inputArea.Dock = System.Windows.Forms.DockStyle.Fill

        #self.inputArea.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        self.inputArea.ScrollBars = System.Windows.Forms.ScrollBars.None;

        self.inputArea.Name = "inputArea"
   
        self.inputArea.RowHeadersDefaultCellStyle.BackColor = System.Drawing.Color.DeepSkyBlue   #DeepSkyBlue
        self.inputArea.RowHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Red
        #Self.inputArea.ColumnHeadersDefaultCellStyle.Font = System.Drawing.Font(DataArea.Font, FontStyle.Bold)

        self.inputArea.AutoSizeColumnsMode =System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill   
        
        self.inputArea.RowHeadersBorderStyle =System.Windows.Forms.DataGridViewHeaderBorderStyle.Single
        self.inputArea.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Single
        self.inputArea.GridColor = System.Drawing.Color.Black
        self.inputArea.RowHeadersVisible = True
        self.inputArea.RowHeadersWidth=150
        #self.inputArea.RowHeaderCell.Size = System.Drawing.Size(800, 200)
   
        
        self.inputArea.RowCount = 8
        self.inputArea.Rows[0].HeaderCell.Value = "Adapter"
        self.inputArea.Rows[1].HeaderCell.Value = "Source MAC"
        self.inputArea.Rows[2].HeaderCell.Value = "Destination MAC"
        self.inputArea.Rows[3].HeaderCell.Value = "Destination IP"
        self.inputArea.Rows[4].HeaderCell.Value = "Ethernet Type"
        self.inputArea.Rows[5].HeaderCell.Value = "Data Length"
        self.inputArea.Rows[6].HeaderCell.Value = "Cyclic Period"
        self.inputArea.Rows[7].HeaderCell.Value = "Repetition No."

        #self.inputArea.Columns[4].DefaultCellStyle.Font =Font(DataArea.DefaultCellStyle.Font, FontStyle.Italic)
        self.inputArea.SelectionMode =System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
        
        self.cbCell=System.Windows.Forms.DataGridViewComboBoxCell()
        #self.cbCell.DataSource=Des
        #self.cbCell.Value=Des[0]
        self.inputArea.Rows[0].Cells[0] = self.cbCell
        
        self.cbCel2=System.Windows.Forms.DataGridViewComboBoxCell()
        
        self.inputArea.Rows[4].Cells[0] = self.cbCel2

        # textBox2
        self.textBox2 = System.Windows.Forms.TextBox()
        self.textBox2.Location = System.Drawing.Point(750, 280)
        self.textBox2.Size =System.Drawing.Size(580, 140)
        
        self.textBox2.AcceptsReturn = True
        self.textBox2.AcceptsTab = True
        #self.textBox2.Dock = System.Windows.Forms.DockStyle.Left
        self.textBox2.Multiline = True
        #self.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
        self.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.None
        self.textBox2.Multiline = True
     #   self.textBox2.ScrollBars = ScrollBars.Vertical
        self.textBox2.Name = "textBox2"
        self.textBox2.AppendText("tree_view") 
        
# --------tab2-----------tab2-----------tab2----------tab2---------tab2---------- 

    
        # Configure btnSave
        self.btn2send = System.Windows.Forms.Button()
        self.btn2send.Text = "&Send"
        self.btn2send.Location = System.Drawing.Point(280, 25) 

        
         #-------- inputArea2 -----------
        self.inputArea2 = System.Windows.Forms.DataGridView()
        
        self.inputArea2.Name = "inputArea2"
        self.inputArea2.Location = System.Drawing.Point(620, 5)
        self.inputArea2.Size = System.Drawing.Size(600, 390)
        #滚动条
        self.inputArea2.ScrollBars = System.Windows.Forms.ScrollBars.None;
        #self.inputArea2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        self.inputArea2.Name = "inputArea2"
   
        self.inputArea2.RowHeadersDefaultCellStyle.BackColor = System.Drawing.Color.DeepSkyBlue   #DeepSkyBlue
        self.inputArea2.RowHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Red
        #Self.inputArea2.ColumnHeadersDefaultCellStyle.Font = System.Drawing.Font(DataArea.Font, FontStyle.Bold)

        self.inputArea2.AutoSizeColumnsMode =System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill   
        
        self.inputArea2.RowHeadersBorderStyle =System.Windows.Forms.DataGridViewHeaderBorderStyle.Single
        self.inputArea2.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.Single
        self.inputArea2.GridColor = System.Drawing.Color.Black
        self.inputArea2.RowHeadersVisible = True
        self.inputArea2.RowHeadersWidth=130
        
        self.inputArea2.RowCount = 16
        self.inputArea2.Rows[0].HeaderCell.Value = "Adapter"
        self.inputArea2.Rows[1].HeaderCell.Value = "Source MAC"
        self.inputArea2.Rows[2].HeaderCell.Value = "Destination MAC"
        self.inputArea2.Rows[3].HeaderCell.Value = "Destination IP"
        self.inputArea2.Rows[4].HeaderCell.Value = "Ethernet Type"
        self.inputArea2.Rows[5].HeaderCell.Value = "Data Length"
        self.inputArea2.Rows[6].HeaderCell.Value = "Cyclic Period"
        self.inputArea2.Rows[7].HeaderCell.Value = "Repetition No."
        self.inputArea2.Rows[8].HeaderCell.Value = "Return Code"
        self.inputArea2.Rows[9].HeaderCell.Value = "ID"
        self.inputArea2.Rows[10].HeaderCell.Value = "Port Destination"
        self.inputArea2.Rows[11].HeaderCell.Value = "Port Source"
        #self.inputArea2.Rows[11].HeaderCell.Value = "Method Identifier"        
        self.inputArea2.Rows[12].HeaderCell.Value = "Protocol Version"
        self.inputArea2.Rows[13].HeaderCell.Value = "Interface Version"                        
        self.inputArea2.Rows[14].HeaderCell.Value = "Inner VLAN"
        self.inputArea2.Rows[15].HeaderCell.Value = "Outer VLAN"

        #self.inputArea.Columns[4].DefaultCellStyle.Font =Font(DataArea.DefaultCellStyle.Font, FontStyle.Italic)
        self.inputArea2.SelectionMode =System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
        
        self.tab2cbCell=System.Windows.Forms.DataGridViewComboBoxCell()      
        self.inputArea2.Rows[0].Cells[0] = self.tab2cbCell
        
        #self.tab2cbCell2=System.Windows.Forms.DataGridViewComboBoxCell()      
        #self.inputArea2.Rows[2].Cells[0] = self.tab2cbCell2
        #self.tab2cbCell2=System.Windows.Forms.DataGridViewComboBoxCell()
        #self.inputArea2.Rows[7].Cells[0] = self.tab2cbCell2
        #self.tab2cbCell2.DataSource=["E_OK","E_NOT_OK",'E_UNKNOWN_SERVICE','E_UNKNOWN_METHOD','E_NOT_READY',
        #                            'E_NOT_REACHADLE','E_TIMEOUT','E_WRONG_PROTOCOL_VEPSION']
        #self.inputArea2.Rows[2].Cells[0].Value = 'FF:FF:FF:FF:FF:FF'
        self.inputArea2.Rows[4].Cells[0].Value ='SOME/IP'
        self.inputArea2.Rows[5].Cells[0].Value = '0'
        self.inputArea2.Rows[8].Cells[0].Value = 'E_OK'
        self.inputArea2.Rows[9].Cells[0].Value = '0'
        self.inputArea2.Rows[10].Cells[0].Value = '30501'
        self.inputArea2.Rows[11].Cells[0].Value = '30491'
        self.inputArea2.Rows[12].Cells[0].Value = '0'
        self.inputArea2.Rows[13].Cells[0].Value = '1'
       # self.inputArea2.Rows[13].Cells[0].Value = '1'
        self.inputArea2.RowTemplate.Height = 25
        self.inputArea2.RowHeadersWidth=150
    # ----------payload---------
        # page2textBox1
        self.page2textBox1 = System.Windows.Forms.TextBox()
        self.page2textBox1.Location = System.Drawing.Point(20, 60)
        self.page2textBox1.Size =System.Drawing.Size(580, 300)
        
        self.page2textBox1.AcceptsReturn = True
        self.page2textBox1.AcceptsTab = True
        self.page2textBox1.Multiline = True   
        self.page2textBox1.ScrollBars = System.Windows.Forms.ScrollBars.None
        self.page2textBox1.Multiline = True
     
        self.page2textBox1.Name = "page2textBox1"
         
        
        # Configure the form.
        self.ClientSize = System.Drawing.Size(1350, 450)
        self.Text = 'Sigent Simple Example 2'
        
        # Add the controls to the tabpage1.
        self.tabpage1.Controls.Add(self.btnConnect)
        self.tabpage1.Controls.Add(self.btnClear)
        self.tabpage1.Controls.Add(self.btnSave)
        self.tabpage1.Controls.Add(self.btnSend)
        self.tabpage1.Controls.Add(self.textBox1)
        self.tabpage1.Controls.Add(self.DataArea)
        self.tabpage1.Controls.Add(self.inputArea)        
        self.tabpage1.Controls.Add(self.textBox2)

        
        # Add the controls to the tabpage2.
        self.tabpage2.Controls.Add(self.inputArea2)
        self.tabpage2.Controls.Add(self.page2textBox1)
        self.tabpage2.Controls.Add(self.btn2send)
                
        
        #add tabpage to tabcontrol
        self.tabcontrol.Controls.Add(self.tabpage1)
        self.tabcontrol.Controls.Add(self.tabpage2)
        
        #add tabcontrol to Control
        self.Controls.Add(self.tabcontrol)    